package Game;

public class Ability extends Card {
	// ATTRIBUTES
	
	Effect effect;
	int level = 1;
	
	// METHODS
	
	public Ability(String _ID) {
		super(_ID);
		initEffect();
	}
	
	/**
	 * Called when unit gains this Ability.
	 * @param unit Unit which gains this Ability.
	 */
	public void onObtain(Unit unit) {
		unit.abilites.add(this);
		effect.onObtain(unit);
	}
	
	/**
	 * Called when unit loses this Ability
	 * @param unit Unit which loses this Ability.
	 */
	public void onDismiss(Unit unit) {
		effect.onDismiss(unit);
		unit.abilites.remove(this);
	}
	
	/**
	 * Sets Ability's effect based on its ID and level.
	 */
	public void initEffect() {
		switch (ID) {
			
		}
	}
	
	/**
	 * Resets Ability's effect when it levels up.
	 * @param unit
	 */
	public void onAbilityLevelUp(Unit unit) {
		onDismiss(unit);
		level++;
		initEffect();
		onObtain(unit);
	}
}
